package com.twu.biblioteca;

public class User {
    private static int firstLibraryNumber = 1111111;

    private int libraryNumber;
    private String password;
    private String name;
    private String email;
    private String phone;

    public User(String password, String name, String email, String phone) {
        this.libraryNumber = firstLibraryNumber++;
        this.password = password;
        this.name = name;
        this.email = email;
        this.phone = phone;
    }

    public String getLibraryNumber() {
        return (libraryNumber / 10000) + "-" + (libraryNumber % 10000);
    }

    public boolean checkPassword(String password) {
        return this.password.equals(password);
    }

    @Override
    public String toString() {
        return name + " " + email + " " + phone;
    }

    public static void initLibraryNumber() {
        firstLibraryNumber = 1111111;
    }
}
